package operation;

import book.BookList;

import java.util.Scanner;

public class lend implements IOperation{
    @Override
    public void work(BookList Booklist) {
        Scanner scanner = new Scanner(System.in);
        find findbyname = new find();
        System.out.print("请输入需要借阅书籍的书名：");
        int number = findbyname.find_name(Booklist, scanner.next());
        if(number<0) {
            System.out.println("未找到该书籍的信息，借阅失败！！！");
        } else{
            if(Booklist.getBooklist()[number].isStatestate()==false) {
                System.out.println("该书籍已被借出，借阅失败！！！");
            } else {
                Booklist.getBooklist()[number].setStatestate(false);
                System.out.println("书籍借阅成功！！！");
            }
        }
    }
}